<%inherit file="/admin/system.html"/>

<%block name="innav">
<li><a href="${ reverse_url('admin:job') }">${ _("Job") }</a></li>
</%block>

<%block name="main">

% if U:
<p class="subtitle">${ _("Filter by user: ") } "${ U.username }"</p>
% endif

% if JOB_LIST.count():
<div>
  ${ page_html }
  <table class="table table-bordered">
    <thead>
      <tr>
        <th><a href="${ sort_by('id') }">${ _("ID") }</a></th>
        <th><a href="${ sort_by('user_id') }">${ _("User") }</a></th>
        <th><a href="${ sort_by('status') }">${ _("Status") }</a></th>
        <th><a href="${ sort_by('target_type') }">${ _("Target Type") }</a></th>
        <th><a href="${ sort_by('target_id') }">${ _("Target ID") }</a></th>
        <th><a href="${ sort_by('action') }">${ _("Action") }</a></th>
        <th><a href="${ sort_by('created') }">${ _("Created") }</a></th>
        <th><a href="${ sort_by('ended') }">${ _("Completed") }</a></th>
      </tr>
    </thead>
    <tbody>
      % for j in JOB_LIST:
      <tr>
        <td>${ j.id }</td>
        <td>
          % if j.user_id:
          <a href="${ reverse_url('admin:user:view') }?id=${ j.user_id }">${ j.user.username }</a>
          % endif
        </td>
        <td>${ j.status_icon } ${ locale.translate(j.status_string) }</td>
        <td>${ j.target_name }</td>
        <td>${ j.target_url }</td>
        <td>${ j.action_string }</td>
        <td>${ ftime(j.created) }</td>
        <td>${ htime(j.ended) }</td>
      </tr>
      % endfor
    </tbody>
  </table>

  ${ page_html }
</div>
% else:
<div class="hero-unit">
  <p>Have not found any jobs.</p>
</div>
% endif

</%block>
